package cn.hxzy.mapper;

import cn.hxzy.pojo.Dis;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author songmengxin
 * @since 2021-07-31
 */
@Repository
public interface DisMapper extends BaseMapper<Dis> {
//    @Select("SELECT * FROM dis where proId=#{proId}")
//    @Results({
//            @Result(property = "user",column ="userId",one =@One(select="cn.hxzy.mapper.UserMapper.getUserById"))
//    })
//    List<Dis> getDisById(String proId);

    @Select("SELECT *,disId did FROM dis where proId=#{proId}")
    @Results({
            @Result(property = "user",column ="userId",one =@One(select="cn.hxzy.mapper.UserMapper.getUserById")),
            @Result(property = "replyList", column = "did", many = @Many(select = "cn.hxzy.mapper.ReplyMapper.getReplyBydisId"))

    })
    List<Dis> getDisById(String proId);
    @Select("SELECT * FROM dis where proId=#{proId}")
    List<Dis> getDisByIdall(String proId);
}
